
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class RmsBusinessSetupConfigServiceImpl implements RmsBusinessSetupConfigService  {

    @Resource
    private RmsBusinessSetupConfigMapper rmsBusinessSetupConfigMapper;

    /**
     * 获取 RmsBusinessSetupConfig 分页列表
     */
    @Transactional
    public IPage getRmsBusinessSetupConfigPagination( PaginationVo paginationVo, RmsBusinessSetupConfigQuery rmsBusinessSetupConfigQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<RmsBusinessSetupConfigEntity> lqs = new LambdaQueryWrapper();
        rmsBusinessSetupConfigMapper.selectPage(page, lqs);

        List<RmsBusinessSetupConfigEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 RmsBusinessSetupConfig 所有数据
     *
    */
    @Transactional
    public List<RmsBusinessSetupConfigEntity> getRmsBusinessSetupConfigAllList( RmsBusinessSetupConfigQuery rmsBusinessSetupConfigQuery ) throws Exception {

        LambdaQueryWrapper<RmsBusinessSetupConfigEntity> lqs = new LambdaQueryWrapper();
        List<RmsBusinessSetupConfigEntity> list = rmsBusinessSetupConfigMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 RmsBusinessSetupConfig 详情
    */
    @Transactional
    public RmsBusinessSetupConfigEntity getRmsBusinessSetupConfigDetail( Long id) throws Exception {

        RmsBusinessSetupConfigEntity rmsBusinessSetupConfig = rmsBusinessSetupConfigMapper.selectById(id);
        return rmsBusinessSetupConfig;
    }


    /**
     * 新增 RmsBusinessSetupConfig
     * */
    @Transactional
    public void addRmsBusinessSetupConfig(RmsBusinessSetupConfigVo rmsBusinessSetupConfigVo) throws Exception {

        RmsBusinessSetupConfigEntity rmsBusinessSetupConfig = new RmsBusinessSetupConfigEntity();
        ReflectionCopy.copyProperties( rmsBusinessSetupConfig, rmsBusinessSetupConfigVo );
        rmsBusinessSetupConfigMapper.insert(rmsBusinessSetupConfig);
        return;
    }


    /**
     * 更新 RmsBusinessSetupConfig
     * */
    @Transactional
    public void updateRmsBusinessSetupConfig( RmsBusinessSetupConfigVo rmsBusinessSetupConfigVo) throws Exception {

        if( rmsBusinessSetupConfigVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        RmsBusinessSetupConfigEntity rmsBusinessSetupConfig = new RmsBusinessSetupConfigEntity();
        ReflectionCopy.copyProperties( rmsBusinessSetupConfig, rmsBusinessSetupConfigVo );
        rmsBusinessSetupConfigMapper.updateById(rmsBusinessSetupConfig);
        return;
    }

    /**
     * 删除 RmsBusinessSetupConfig
     * */
    @Transactional
    public void batchRemoveRmsBusinessSetupConfig( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        rmsBusinessSetupConfigMapper.deleteBatchIds(ids);
    }

}

      